﻿package plugin.duanzao.view
{
    import __AS3__.vec.*;
    import base.component.*;
    import cmd.*;
    import com.core.*;
    import com.sh.game.display.*;
    import com.sh.game.util.*;
    import consts.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.utils.*;
    import manager.*;
    import morn.core.components.*;
    import morn.core.handlers.*;
    import plugin.duanzao.*;
    import plugin.duanzao.component.*;
    import pluginfw.nio.*;
    import uiresource.*;

    public class HeChengView extends HeChengUI
    {
        private var _hecgonfig:Object;
        private var _titlestrArr:Array;
        private var _title2strArr:Array;
        private var _titlesVec:Vector.<ButtonImg>;
        private var _tItem2Vec:Vector.<TileItem2>;
        private var _listdata:Array;
        private var _clsCom:Array;
        private var _curclsCom:Array;
        private var _curComItem:Object;
        private var _clstype:int = 0;
        private var _titletype:int = 1;
        private var _ComArr:Array;
        private var _showlist:Boolean = false;
        private var itemconfig:Object;
        public var mUIBase:DuanZao;
        private var _hechengmain:Object;
        private var _confitem:Object;
        private var _newqh:Object;
        private var _bagArms:Array;
        private var _roleArms:Array;
        private var costname:Object;
        private var _vbox2h:int = 0;
        private var newitemid:int = 0;
        private var mainobj:Object = null;
        private var _timedID:uint = 0;
        private var hbt1:int = 30;
        private var hbt2:int = 28;
        private var hbt3:int = 27;
        private var k:int;
        private var newtitlestrArr:Array;
        private var cc_clsCom:Array;
        private var sj_lv:int;
        private var shuliangcount:int;
        private var hasshuliancount:int;
        private var _showAlert:Boolean = true;
        private var newid:int = 0;

        public function HeChengView()
        {
            this._titlestrArr = [];
            this._title2strArr = [];
            this._titlesVec = new Vector.<ButtonImg>;
            this._tItem2Vec = new Vector.<TileItem2>;
            this._listdata = [];
            this._clsCom = [];
            this._ComArr = [];
            this._bagArms = [];
            this._roleArms = [];
            this.costname = {1:"绑定金币：", 3:"元宝:", 6:"金币:"};
            this.newtitlestrArr = [];
            this.cc_clsCom = [];
            return;
        }// end function

        public function openRefresh(param1:Object) : void
        {
            var _loc_4:Object = null;
            var _loc_5:int = 0;
            var _loc_2:int = 1;
            var _loc_3:int = 0;
            if (param1)
            {
                _loc_2 = param1.gototype;
                _loc_3 = param1.newid;
                this.newitemid = _loc_3;
            }
            namelabel.text = "";
            if (_loc_3 > 0)
            {
                if (this._hecgonfig == null)
                {
                    this._hecgonfig = ConfigDictionary.data.hechengnew;
                }
                _loc_4 = this._hecgonfig[_loc_3];
                if (_loc_4)
                {
                    this._clstype = _loc_4.clstype;
                    this._titletype = _loc_4.titltype;
                    if (this._titletype == 0)
                    {
                        this._titletype = 1;
                    }
                    this.btntitleShow(this._clstype);
                    this.clickTitle2(this._titletype, false);
                    _loc_5 = 0;
                    while (_loc_5 < this._listdata.length)
                    {
                        
                        if (this._listdata[_loc_5].itemid == _loc_3)
                        {
                            _list.selectedIndex = _loc_5;
                            break;
                        }
                        _loc_5++;
                    }
                }
            }
            this.updateCompound();
            this.updatecost();
            _ComList.selectedIndex = -1;
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            if (this._hecgonfig == null)
            {
                this._hecgonfig = ConfigDictionary.data.hechengnew;
            }
            _costtxt3.visible = false;
            this.initlist();
            return;
        }// end function

        override protected function createChildren() : void
        {
            loadUI("HeCheng.xml");
            return;
        }// end function

        public function initlist() : void
        {
            var _loc_1:Object = null;
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_5:ButtonImg = null;
            for each (_loc_1 in this._hecgonfig)
            {
                
                if (_loc_1.itemtype == 2)
                {
                    if (this._titlestrArr[_loc_1.clstype] == null)
                    {
                        (this.k + 1);
                        this._titlestrArr[_loc_1.clstype] = _loc_1.clsname;
                        this.newtitlestrArr[this.k] = _loc_1.clsname;
                    }
                    if (this.cc_clsCom[_loc_1.clstype] == null)
                    {
                        this.cc_clsCom[_loc_1.clstype] = new Array();
                    }
                    (this.cc_clsCom[_loc_1.clstype] as Array).push(_loc_1);
                    this._clsCom[this.k] = this.cc_clsCom[_loc_1.clstype];
                }
            }
            _btnsList.removeAllChild();
            _loc_2 = 0;
            _loc_3 = 1;
            while (_loc_3 < this.newtitlestrArr.length)
            {
                
                _loc_2 = _loc_3;
                _loc_5 = new ButtonImg("png.duanzao.btn_cs2anniu", this.newtitlestrArr[_loc_2], null, "right", "bottom");
                _loc_5.imgRetation(-10);
                _loc_5.labelColors = "0xB79059,0xB79059,0xB79059";
                _loc_5.labelStroke = "0x0";
                _loc_5.labelFont = "Microsoft YaHei";
                _loc_5.y = this.hbt1 * (_loc_3 - 1);
                _loc_5.clickHandler = new Handler(this.btntitleShow, [_loc_2]);
                _loc_5.imgVisible(false);
                this._titlesVec.push(_loc_5);
                _btnsList.addChild(_loc_5);
                _loc_3++;
            }
            _checkbox2.clickHandler = new Handler(this.checkcom);
            var _loc_4:* = ModelProxy.getValue("localCache", "option");
            _checkbox2.selected = _loc_4.showcom;
            this.updateComlist();
            this.btntitleShow(1);
            _list.selectHandler = new Handler(this.listSelectHandler);
            this.showIntoItem(this.newitemid);
            this.addListener();
            return;
        }// end function

        private function btntitleShow(param1:int) : void
        {
            var _loc_2:int = 0;
            var _loc_4:Object = null;
            var _loc_5:TileItem2 = null;
            var _loc_6:Object = null;
            this.sj_lv = ModelProxy.getValue("data", "worldlevel");
            if (this._clstype == param1)
            {
                _loc_2 = 0;
                while (_loc_2 < this._tItem2Vec.length)
                {
                    
                    if (this._tItem2Vec[_loc_2].parent)
                    {
                        _btnsList.removeChild(this._tItem2Vec[_loc_2]);
                    }
                    _loc_2++;
                }
                if (_list.parent)
                {
                    _btnsList.removeChild(_list);
                }
                this.updateCompound();
                return;
            }
            if (param1 > 0)
            {
                this._clstype = param1;
            }
            else
            {
                return;
            }
            this._curclsCom = this._clsCom[this._clstype];
            if (this._curclsCom == null)
            {
                return;
            }
            var _loc_3:int = 0;
            this._title2strArr.length = 0;
            this._title2strArr = [];
            for each (_loc_4 in this._curclsCom)
            {
                
                _loc_3 = _loc_4.titltype;
                if (_loc_3 >= 1 && this._title2strArr[_loc_3] == null)
                {
                    if (this.sj_lv >= _loc_4.worldlevel)
                    {
                        this._title2strArr[_loc_3] = [_loc_4.titlename, _loc_4.worldlevel];
                    }
                }
            }
            _loc_2 = 0;
            while (_loc_2 < this._titlesVec.length)
            {
                
                this._titlesVec[_loc_2].selected = (_loc_2 + 1) == this._clstype;
                if ((_loc_2 + 1) <= this._clstype)
                {
                    this._titlesVec[_loc_2].y = this.hbt1 * _loc_2;
                }
                else
                {
                    this._titlesVec[_loc_2].y = this.hbt1 * _loc_2 + this.hbt2 * (this._title2strArr.length - 1);
                }
                _loc_2++;
            }
            _loc_2 = 1;
            while (_loc_2 < this._title2strArr.length)
            {
                
                _loc_6 = new Object();
                _loc_6.titlename = this._title2strArr[_loc_2][0];
                _loc_6.titltype = _loc_2;
                if (this._tItem2Vec.length > (_loc_2 - 1))
                {
                    _loc_5 = this._tItem2Vec[(_loc_2 - 1)];
                }
                else
                {
                    _loc_5 = new TileItem2(this.clickTitle2);
                    this._tItem2Vec.push(_loc_5);
                }
                _loc_5.data = _loc_6;
                _loc_5.selected = false;
                _loc_5.y = this.hbt2 * (_loc_2 - 1) + this.hbt1 * this._clstype;
                _btnsList.addChild(_loc_5);
                _loc_2++;
            }
            _loc_2 = this._title2strArr.length - 1;
            while (_loc_2 < this._tItem2Vec.length)
            {
                
                if (this._tItem2Vec[_loc_2].parent)
                {
                    _btnsList.removeChild(this._tItem2Vec[_loc_2]);
                }
                _loc_2++;
            }
            if (_list.parent)
            {
                _btnsList.removeChild(_list);
            }
            this.updateCompound();
            return;
        }// end function

        private function checkcom() : void
        {
            var _loc_1:* = ModelProxy.getValue("localCache", "option");
            _loc_1.showcom = _checkbox2.selected;
            this.updateComlist();
            return;
        }// end function

        public function updateComlist() : void
        {
            var _loc_4:Object = null;
            var _loc_5:int = 0;
            var _loc_6:Object = null;
            var _loc_7:String = null;
            var _loc_8:int = 0;
            if (this.visible == false)
            {
                return;
            }
            var _loc_1:* = ModelProxy.getValue("localCache", "option");
            var _loc_2:* = _loc_1.showcom;
            _btnsList.visible = !_loc_2;
            _ComList.visible = _loc_2;
            this._ComArr = [];
            if (this._hecgonfig == null)
            {
                this._hecgonfig = ConfigDictionary.data.hechengnew;
            }
            if (this.itemconfig == null)
            {
                this.itemconfig = ConfigDictionary.data.item;
            }
            var _loc_3:int = 0;
            while (_loc_3 < this._titlesVec.length)
            {
                
                this._titlesVec[_loc_3].imgVisible(false);
                _loc_3++;
            }
            for each (_loc_4 in this._hecgonfig)
            {
                
                if (_loc_4.itemtype == 2)
                {
                    _loc_5 = this.getcount(_loc_4);
                    if (_loc_5 > 0)
                    {
                        _loc_6 = {};
                        _loc_6.cfg = this.itemconfig[_loc_4.newid];
                        _loc_6.compcount = _loc_5;
                        for (_loc_7 in _loc_4)
                        {
                            
                            _loc_6[_loc_7] = _loc_4[_loc_7];
                        }
                        this._ComArr.push([_loc_6.cfg, _loc_6.compcount]);
                        this._titlesVec[(this.k - 1)].imgVisible(true);
                    }
                }
            }
            this.renderComlist();
            if (_ComList.selectedItem)
            {
                _loc_8 = _ComList.selectedItem.itemid;
                this.newitemid = _loc_8;
            }
            return;
        }// end function

        private function renderComlist() : void
        {
            _ComList.array = this._ComArr;
            _ComList.renderHandler = new Handler(this.comlistRender);
            return;
        }// end function

        private function comlistRender(param1:Component, param2:int) : void
        {
            var _loc_3:Label = null;
            var _loc_4:Label = null;
            if (param2 < _ComList.length)
            {
                _loc_3 = param1.getChildByName("name") as Label;
                _loc_3.text = _ComList.array[param2][0].name;
                _loc_4 = param1.getChildByName("count") as Label;
                _loc_4.x = 125;
                _loc_4.y = 6;
                _loc_4.width = 40;
                _loc_4.text = "[" + _ComList.array[param2][1] + "]";
            }
            return;
        }// end function

        public function showIntoItem(param1:int) : void
        {
            namelabel.text = "";
            if (this._hecgonfig == null)
            {
                this._hecgonfig = ConfigDictionary.data.hechengnew;
            }
            if (this.itemconfig == null)
            {
                this.itemconfig = ConfigDictionary.data.item;
            }
            this._curComItem = this._hecgonfig[param1];
            if (this._curComItem == null)
            {
                item1.data = {icon:""};
                item2.data = {icon:""};
                item3.data = {icon:""};
                newitem.data = {icon:""};
                return;
            }
            var _loc_2:* = this._curComItem.mainid;
            var _loc_3:* = this.itemconfig[_loc_2];
            var _loc_4:* = this._curComItem.count;
            this.shuliangcount = _loc_4;
            var _loc_5:* = this._curComItem.assist;
            var _loc_6:* = this.itemconfig[this._curComItem.newid];
            newitem.data = _loc_6;
            namelabel.text = _loc_6.name;
            var _loc_7:* = this.getallcount(_loc_2);
            this.hasshuliancount = _loc_7;
            if (_loc_4 <= 3)
            {
                if (_loc_7 >= 1)
                {
                    item1.data = _loc_3;
                    (item1.getChildByName("count") as Label).color = MColor.New62;
                    (item1.getChildByName("count") as Label).text = "1/1";
                }
                else
                {
                    item1.data = _loc_3;
                    (item1.getChildByName("count") as Label).color = MColor.New56;
                    (item1.getChildByName("count") as Label).text = "0/1";
                }
                if (_loc_7 >= 2)
                {
                    item2.data = _loc_3;
                    (item2.getChildByName("count") as Label).color = MColor.New62;
                    (item2.getChildByName("count") as Label).text = "1/1";
                }
                else
                {
                    item2.data = _loc_3;
                    (item2.getChildByName("count") as Label).color = MColor.New56;
                    (item2.getChildByName("count") as Label).text = "0/1";
                }
                if (_loc_7 >= 3)
                {
                    item3.data = _loc_3;
                    (item3.getChildByName("count") as Label).color = MColor.New62;
                    (item3.getChildByName("count") as Label).text = "1/1";
                }
                else
                {
                    item3.data = _loc_3;
                    (item3.getChildByName("count") as Label).color = MColor.New56;
                    (item3.getChildByName("count") as Label).text = "0/1";
                }
            }
            else
            {
                item1.data = _loc_3;
                (item1.getChildByName("count") as Label).text = _loc_7 + "/" + _loc_4;
                if (_loc_7 >= _loc_4)
                {
                    (item1.getChildByName("count") as Label).color = MColor.New62;
                }
                else
                {
                    (item1.getChildByName("count") as Label).color = MColor.New56;
                }
                item2.data = {icon:""};
                item3.data = {icon:""};
            }
            return;
        }// end function

        public function clickTitle2(param1:int, param2:Boolean) : void
        {
            var _loc_4:TileItem2 = null;
            _list.selectedIndex = -1;
            this._showlist = !param2;
            if (_list.parent)
            {
                _list.parent.removeChild(_list);
            }
            var _loc_3:int = 1;
            while (_loc_3 < this._title2strArr.length)
            {
                
                _loc_4 = this._tItem2Vec[(_loc_3 - 1)];
                if (_loc_4.data.titltype == param1)
                {
                    if (param2)
                    {
                        _loc_4.selected = false;
                        this.showlist(-1);
                    }
                    else
                    {
                        _loc_4.selected = true;
                        this.showlist(param1);
                    }
                }
                else
                {
                    _loc_4.selected = false;
                }
                _loc_3++;
            }
            return;
        }// end function

        private function showlist(param1:int) : void
        {
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            var _loc_5:String = null;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_8:TileItem2 = null;
            _btnsList.removeAllChild();
            this._titletype = param1;
            if (this.itemconfig == null)
            {
                this.itemconfig = ConfigDictionary.data.item;
            }
            this._listdata = [];
            if (param1 > 0)
            {
                for each (_loc_3 in this._curclsCom)
                {
                    
                    if (_loc_3.titltype == param1 || _loc_3.titltype == 0)
                    {
                        _loc_4 = {};
                        _loc_4.cfg = this.itemconfig[_loc_3.newid];
                        if (_loc_4 == null)
                        {
                            continue;
                        }
                        for (_loc_5 in _loc_3)
                        {
                            
                            _loc_4[_loc_5] = _loc_3[_loc_5];
                        }
                        _loc_4.compcount = this.getcount(_loc_4.cfg);
                        this._listdata.push([_loc_4.cfg, _loc_4.compcount]);
                    }
                }
                this._listdata[0].sortOn("sortindex", Array.NUMERIC);
            }
            this.renderlist();
            var _loc_2:int = 0;
            while (_loc_2 < this._titlesVec.length)
            {
                
                if (_loc_2 < (this._clstype - 1))
                {
                }
                else if (_loc_2 == (this._clstype - 1))
                {
                    _loc_6 = this.hbt1 * this._clstype;
                    _loc_7 = 1;
                    while (_loc_7 < this._title2strArr.length)
                    {
                        
                        _loc_8 = this._tItem2Vec[(_loc_7 - 1)];
                        if (_loc_7 < this._titletype)
                        {
                            _loc_8.y = _loc_6 + (_loc_7 - 1) * this.hbt2;
                        }
                        else if (_loc_7 == this._titletype)
                        {
                            _loc_8.y = _loc_6 + (_loc_7 - 1) * this.hbt2;
                        }
                        else
                        {
                            _loc_8.y = _loc_6 + (_loc_7 - 1) * this.hbt2 + this._listdata.length * this.hbt3;
                        }
                        _btnsList.addChild(_loc_8);
                        _loc_7++;
                    }
                    _list.y = _loc_6 + this._titletype * this.hbt2;
                    _btnsList.addChild(_list);
                }
                else
                {
                    this._titlesVec[_loc_2].y = this.hbt1 * _loc_2 + (this._title2strArr.length - 1) * this.hbt2 + this._listdata.length * this.hbt3;
                }
                _btnsList.addChild(this._titlesVec[_loc_2]);
                _loc_2++;
            }
            return;
        }// end function

        private function renderlist() : void
        {
            _list.repeatY = this._listdata.length;
            _list.array = this._listdata;
            _list.renderHandler = new Handler(this.listlistRender);
            return;
        }// end function

        private function listlistRender(param1:Component, param2:int) : void
        {
            var _loc_3:Label = null;
            var _loc_4:Label = null;
            if (param2 < _list.length)
            {
                _loc_3 = param1.getChildByName("comname") as Label;
                _loc_4 = param1.getChildByName("count") as Label;
                _loc_4.x = 125;
                _loc_4.y = 6;
                _loc_4.width = 40;
                _loc_3.text = _list.array[param2][0].name;
                if (_list.array[param2][1] > 0)
                {
                    _loc_4.text = "[" + _list.array[param2][1] + "]";
                }
                else
                {
                    _loc_4.text = "";
                }
            }
            return;
        }// end function

        protected function clip1CompleteHandler() : void
        {
            var _loc_1:* = XMLMcManager.instance.getPluginMc("qianghua", "newsHCsucces");
            if (_loc_1 && _loc_1.parent)
            {
                _loc_1.parent.removeChild(_loc_1);
            }
            return;
        }// end function

        private function addListener() : void
        {
            btn1.addEventListener(MouseEvent.CLICK, this.btn1Handler);
            _ComList.selectHandler = new Handler(this.ComListHandler);
            return;
        }// end function

        protected function btn1Handler(event:MouseEvent) : void
        {
            event.stopPropagation();
            if (this.hasshuliancount < this.shuliangcount)
            {
                WarningManager.show(70);
                return;
            }
            ModelProxy.change("data", "hechengpoint", new Point(event.stageX + 10, event.stageY - 270));
            if (this._curComItem == null)
            {
                return;
            }
            this.newid = this._curComItem.newid;
            if (this.newid <= 0)
            {
                return;
            }
            this.showstart();
            return;
        }// end function

        private function showstart(param1:int = 0) : void
        {
            if (this._timedID > 0)
            {
                clearTimeout(this._timedID);
            }
            this._timedID = setTimeout(this.dostart1, 10, param1);
            PluginManager.instance.playSound(SoundType.BTN_ARMON2);
            return;
        }// end function

        private function dostart1(param1:int = 1) : void
        {
            var _loc_4:Object = null;
            if (this.newid <= 0)
            {
                return;
            }
            var _loc_2:int = 0;
            var _loc_3:* = new Output();
            _loc_3.writeVarInt(this.newid, false);
            if (param1 == 0)
            {
                _loc_3.writeVarInt(1, false);
                PluginManager.instance.sendToBufferServer("qianghua", CMDQiangHua.cailiaohec, _loc_3);
            }
            else
            {
                _loc_4 = this._hecgonfig[this.newid];
                if (_loc_4 == null)
                {
                    return;
                }
                _loc_2 = this.getcount(_loc_4);
                _loc_3.writeVarInt(_loc_2, false);
                PluginManager.instance.sendToBufferServer("qianghua", CMDQiangHua.cailiaohec, _loc_3);
            }
            return;
        }// end function

        private function ComListHandler(param1:int) : void
        {
            var _loc_2:int = 0;
            if (_ComList.selectedItem)
            {
                _loc_2 = _ComList.selectedItem[0].itemid;
                this.newitemid = _loc_2;
                this.showIntoItem(_loc_2);
            }
            return;
        }// end function

        private function listSelectHandler(param1:int) : void
        {
            var _loc_2:int = 0;
            if (_list.selectedItem)
            {
                _loc_2 = _list.selectedItem[0].itemid;
                this.newitemid = _loc_2;
                this.showIntoItem(_loc_2);
            }
            return;
        }// end function

        protected function closeHandler(event:MouseEvent) : void
        {
            this.mUIBase.close();
            return;
        }// end function

        public function sucess(param1:int) : void
        {
            var _loc_4:Object = null;
            var _loc_2:* = ModelProxy.getValue("localCache", "option");
            if (_loc_2.offbasesound != 1)
            {
                ModelProxy.change("main", "playsound", SoundType.HC_1);
            }
            var _loc_3:* = XMLMcManager.instance.getPluginMc("qianghua", "newsHCsucces");
            if (_loc_3)
            {
                _loc_3.x = 225;
                _loc_3.y = -100;
                _loc_3.interval = 120;
                _loc_3.playFromTo(-1, (_loc_3.totalFrame - 1), new Handler(this.clip1CompleteHandler));
                this.addChild(_loc_3);
            }
            if (param1 == 1)
            {
                if (this.newitemid > 0)
                {
                    this.showIntoItem(this.newitemid);
                }
                if (this._ComArr.length <= 0)
                {
                    _loc_4 = UserData.getUserData();
                    if (_loc_4.level < 55)
                    {
                        this.mUIBase.close();
                    }
                }
            }
            PluginManager.instance.playSound(SoundType.BTN_XUNBAO);
            return;
        }// end function

        protected function btn2Handler(event:MouseEvent) : void
        {
            if (this._timedID > 0)
            {
                clearTimeout(this._timedID);
            }
            return;
        }// end function

        public function updateCompounds() : void
        {
            if (this.visible)
            {
                this.updateCompound();
            }
            return;
        }// end function

        public function updateCompound() : void
        {
            var _loc_1:TileItem2 = null;
            var _loc_3:Array = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:Object = null;
            var _loc_7:Object = null;
            var _loc_8:String = null;
            var _loc_2:int = 1;
            while (_loc_2 < this._title2strArr.length)
            {
                
                _loc_1 = this._tItem2Vec[(_loc_2 - 1)];
                if (!_loc_1.visible)
                {
                    return;
                }
                if (this.itemconfig == null)
                {
                    this.itemconfig = ConfigDictionary.data.item;
                }
                _loc_3 = [];
                _loc_4 = 0;
                _loc_5 = 0;
                while (_loc_5 < this._curclsCom.length)
                {
                    
                    _loc_6 = this._curclsCom[_loc_5];
                    if (_loc_6.titltype == 0 || _loc_6.titltype == _loc_1.data.titltype)
                    {
                        _loc_7 = this.itemconfig[_loc_6.newid];
                        if (_loc_7)
                        {
                            for (_loc_8 in _loc_6)
                            {
                                
                                _loc_7[_loc_8] = _loc_6[_loc_8];
                            }
                            _loc_4 = _loc_4 + this.getcount(_loc_7);
                        }
                    }
                    _loc_5++;
                }
                _loc_1.showimg(_loc_4);
                _loc_2++;
            }
            return;
        }// end function

        private function getbagItems() : Array
        {
            var _loc_4:Object = null;
            var _loc_1:* = UserData.getBagData();
            var _loc_2:* = _loc_1.maxcount;
            if (this._hechengmain == null)
            {
                this._hechengmain = ConfigDictionary.data.compound;
            }
            this._bagArms = [];
            var _loc_3:int = 1;
            while (_loc_3 < _loc_2)
            {
                
                _loc_4 = _loc_1[_loc_3];
                if (_loc_4)
                {
                    if (_loc_4[2] == 1 && _loc_4[4])
                    {
                        if (this._hechengmain[_loc_4[4].itemid] && this._hechengmain[_loc_4[4].itemid].tooltype == 2)
                        {
                            this._bagArms.push(_loc_4[4]);
                        }
                    }
                }
                _loc_3++;
            }
            return this._bagArms;
        }// end function

        private function getRoleArm() : Array
        {
            var _loc_2:String = null;
            var _loc_3:int = 0;
            var _loc_4:Object = null;
            var _loc_1:* = ModelProxy.getValue("data", "arms");
            if (this._hechengmain == null)
            {
                this._hechengmain = ConfigDictionary.data.compound;
            }
            this._roleArms = [];
            for (_loc_2 in _loc_1)
            {
                
                _loc_3 = int(_loc_2);
                if (_loc_3 >= 1 && _loc_3 <= 14 || _loc_3 >= 100)
                {
                    _loc_4 = _loc_1[_loc_3];
                    if (_loc_4)
                    {
                        if (this._hechengmain[_loc_4.itemid] && this._hechengmain[_loc_4.itemid].tooltype == 2)
                        {
                            this._roleArms.push(_loc_4);
                        }
                    }
                }
            }
            return this._roleArms;
        }// end function

        public function updatecosts() : void
        {
            if (this.visible == false)
            {
                return;
            }
            this.updatecost();
            return;
        }// end function

        public function updatecost() : void
        {
            var _loc_1:int = 0;
            var _loc_2:Object = null;
            if (_list && _list.parent)
            {
                _loc_1 = 0;
                while (_loc_1 < this._listdata.length)
                {
                    
                    _loc_2 = this._listdata[_loc_1][0];
                    this._listdata[_loc_1][1] = this.getcount(_loc_2);
                    _loc_1++;
                }
                this.renderlist();
            }
            this.showIntoItem(this.newitemid);
            this.updateComlist();
            return;
        }// end function

        private function getcount(param1:Object) : int
        {
            var _loc_4:Array = null;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_2:int = 0;
            var _loc_3:* = param1.mainid;
            _loc_2 = this.getallcount(_loc_3) / param1.count;
            if (param1.assist)
            {
                _loc_4 = String(param1.assist).split("#");
                _loc_5 = 0;
                while (_loc_5 < _loc_4.length)
                {
                    
                    if (_loc_5 % 2 > 0)
                    {
                    }
                    else
                    {
                        _loc_6 = _loc_4[_loc_5];
                        _loc_7 = _loc_4[(_loc_5 + 1)];
                        _loc_2 = int(this.getallcount(_loc_6) / _loc_7) < _loc_2 ? (int(this.getallcount(_loc_6) / _loc_7)) : (_loc_2);
                    }
                    _loc_5++;
                }
            }
            return _loc_2;
        }// end function

        public function getallcount(param1:int) : int
        {
            var _loc_6:Object = null;
            var _loc_7:Number = NaN;
            var _loc_2:int = 0;
            var _loc_3:* = UserData.getBagData();
            var _loc_4:* = _loc_3.maxcount;
            var _loc_5:int = 1;
            while (_loc_5 < _loc_4)
            {
                
                _loc_6 = _loc_3[_loc_5];
                if (_loc_6)
                {
                    if (_loc_6[4] && _loc_6[4].itemid == param1)
                    {
                        if (_loc_6[3] > 0)
                        {
                            _loc_7 = ModelProxy.getValue("data", "servertime") + Number(getTimer());
                            if (_loc_6[3] < _loc_7)
                            {
                                ;
                            }
                        }
                        _loc_2 = _loc_2 + _loc_6[1];
                    }
                }
                _loc_5++;
            }
            return _loc_2;
        }// end function

        private function getSuperlevel(param1:Object, param2:int) : int
        {
            var _loc_7:Object = null;
            var _loc_8:int = 0;
            if (this._newqh == null)
            {
                this._newqh = ConfigDictionary.data.newqh;
            }
            param1.totalupvalue = param2;
            var _loc_3:* = param1.level;
            var _loc_4:int = 0;
            var _loc_5:* = this._newqh[_loc_3];
            var _loc_6:Boolean = true;
            while (_loc_6)
            {
                
                _loc_7 = _loc_5[_loc_4];
                _loc_8 = int(_loc_7.value);
                if (_loc_8 <= param2)
                {
                    _loc_4++;
                    param2 = param2 - _loc_8;
                    if (_loc_4 == 15)
                    {
                        _loc_6 = false;
                    }
                    continue;
                }
                _loc_6 = false;
            }
            param1.superlevel = _loc_4;
            return _loc_4;
        }// end function

    }
}
